home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIObserverService.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  180 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIObserverService.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIObserverService_h__
  6. #define __gen_nsIObserverService_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIObserver; /* forward declaration */
  18.  
  19. class nsISimpleEnumerator; /* forward declaration */
  20.  
  21.  
  22. /* starting interface:    nsIObserverService */
  23. #define NS_IOBSERVERSERVICE_IID_STR "d07f5192-e3d1-11d2-8acd-00105a1b8860"
  24.  
  25. #define NS_IOBSERVERSERVICE_IID \
  26.   {0xd07f5192, 0xe3d1, 0x11d2, \
  27.     { 0x8a, 0xcd, 0x00, 0x10, 0x5a, 0x1b, 0x88, 0x60 }}
  28.  
  29. /**
  30.  * nsIObserverService
  31.  * 
  32.  * Service allows a client listener (nsIObserver) to register and unregister for 
  33.  * notifications of specific string referenced topic. Service also provides a 
  34.  * way to notify registered listeners and a way to enumerate registered client 
  35.  * listeners.
  36.  * 
  37.  * @status FROZEN
  38.  */
  39. class NS_NO_VTABLE nsIObserverService : public nsISupports {
  40.  public: 
  41.  
  42.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBSERVERSERVICE_IID)
  43.  
  44.   /**
  45.      * AddObserver
  46.      *
  47.      * Registers a given listener for a notifications regarding the specified
  48.      * topic.
  49.      *
  50.      * @param anObserve : The interface pointer which will receive notifications.
  51.      * @param aTopic    : The notification topic or subject.
  52.      * @param ownsWeak  : If set to false, the nsIObserverService will hold a 
  53.      *                    strong reference to |anObserver|.  If set to true and 
  54.      *                    |anObserver| supports the nsIWeakReference interface,
  55.      *                    a weak reference will be held.  Otherwise an error will be
  56.      *                    returned.
  57.      */
  58.   /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean ownsWeak); */
  59.   NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) = 0;
  60.  
  61.   /**
  62.      * removeObserver
  63.      *
  64.      * Unregisters a given listener from notifications regarding the specified
  65.      * topic.
  66.      *
  67.      * @param anObserver : The interface pointer which will stop recieving
  68.      *                     notifications.
  69.      * @param aTopic     : The notification topic or subject.
  70.      */
  71.   /* void removeObserver (in nsIObserver anObserver, in string aTopic); */
  72.   NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) = 0;
  73.  
  74.   /**
  75.      * notifyObservers
  76.      *
  77.      * Notifies all registered listeners of the given topic.
  78.      *
  79.      * @param aSubject : Notification specific interface pointer.
  80.      * @param aTopic   : The notification topic or subject.
  81.      * @param someData : Notification specific wide string.
  82.      */
  83.   /* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring someData); */
  84.   NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) = 0;
  85.  
  86.   /**
  87.      * enumerateObservers
  88.      *
  89.      * Returns an enumeration of all registered listeners.
  90.      *
  91.      * @param aTopic   : The notification topic or subject.
  92.      */
  93.   /* nsISimpleEnumerator enumerateObservers (in string aTopic); */
  94.   NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) = 0;
  95.  
  96. };
  97.  
  98. /* Use this macro when declaring classes that implement this interface. */
  99. #define NS_DECL_NSIOBSERVERSERVICE \
  100.   NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak); \
  101.   NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic); \
  102.   NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData); \
  103.   NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval); 
  104.  
  105. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  106. #define NS_FORWARD_NSIOBSERVERSERVICE(_to) \
  107.   NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return _to AddObserver(anObserver, aTopic, ownsWeak); } \
  108.   NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return _to RemoveObserver(anObserver, aTopic); } \
  109.   NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return _to NotifyObservers(aSubject, aTopic, someData); } \
  110.   NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return _to EnumerateObservers(aTopic, _retval); } 
  111.  
  112. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  113. #define NS_FORWARD_SAFE_NSIOBSERVERSERVICE(_to) \
  114.   NS_IMETHOD AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(anObserver, aTopic, ownsWeak); } \
  115.   NS_IMETHOD RemoveObserver(nsIObserver *anObserver, const char *aTopic) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(anObserver, aTopic); } \
  116.   NS_IMETHOD NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyObservers(aSubject, aTopic, someData); } \
  117.   NS_IMETHOD EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateObservers(aTopic, _retval); } 
  118.  
  119. #if 0
  120. /* Use the code below as a template for the implementation class for this interface. */
  121.  
  122. /* Header file */
  123. class nsObserverService : public nsIObserverService
  124. {
  125. public:
  126.   NS_DECL_ISUPPORTS
  127.   NS_DECL_NSIOBSERVERSERVICE
  128.  
  129.   nsObserverService();
  130.  
  131. private:
  132.   ~nsObserverService();
  133.  
  134. protected:
  135.   /* additional members */
  136. };
  137.  
  138. /* Implementation file */
  139. NS_IMPL_ISUPPORTS1(nsObserverService, nsIObserverService)
  140.  
  141. nsObserverService::nsObserverService()
  142. {
  143.   /* member initializers and constructor code */
  144. }
  145.  
  146. nsObserverService::~nsObserverService()
  147. {
  148.   /* destructor code */
  149. }
  150.  
  151. /* void addObserver (in nsIObserver anObserver, in string aTopic, in boolean ownsWeak); */
  152. NS_IMETHODIMP nsObserverService::AddObserver(nsIObserver *anObserver, const char *aTopic, PRBool ownsWeak)
  153. {
  154.     return NS_ERROR_NOT_IMPLEMENTED;
  155. }
  156.  
  157. /* void removeObserver (in nsIObserver anObserver, in string aTopic); */
  158. NS_IMETHODIMP nsObserverService::RemoveObserver(nsIObserver *anObserver, const char *aTopic)
  159. {
  160.     return NS_ERROR_NOT_IMPLEMENTED;
  161. }
  162.  
  163. /* void notifyObservers (in nsISupports aSubject, in string aTopic, in wstring someData); */
  164. NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
  165. {
  166.     return NS_ERROR_NOT_IMPLEMENTED;
  167. }
  168.  
  169. /* nsISimpleEnumerator enumerateObservers (in string aTopic); */
  170. NS_IMETHODIMP nsObserverService::EnumerateObservers(const char *aTopic, nsISimpleEnumerator **_retval)
  171. {
  172.     return NS_ERROR_NOT_IMPLEMENTED;
  173. }
  174.  
  175. /* End of implementation class template. */
  176. #endif
  177.  
  178.  
  179. #endif /* __gen_nsIObserverService_h__ */
  180.